/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023.
 * Description: dump nfs debug info
 * Author: Pang LiYuan
 * Create: 2023-09-15
 */
#ifndef __RTOS_DEBUGINFO_H__
#define __RTOS_DEBUGINFO_H__

#include <linux/seq_file.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/svc.h>

/* rtos_debuginfo.c */
#ifdef CONFIG_RTOS_FS_NFS_DEBUG
void rpc_dump_debuginfo(struct seq_file *seq, const struct rpc_version *vers);
void  svc_dump_debuginfo(struct seq_file *seq, const struct svc_version *vers, int idx);
ssize_t rpc_proc_write_clnt_throttle(struct file *file,
		const char __user *buf, size_t count, loff_t *offs);
#else
static inline void rpc_dump_debuginfo(struct seq_file *seq, const struct rpc_version *vers) {}
static inline void svc_dump_debuginfo(struct seq_file *seq, const struct svc_version *vers, int idx) {}
static inline ssize_t rpc_proc_write_clnt_throttle(struct file *file,
		const char __user *buf, size_t count, loff_t *offs)
{
	return 0;
}
#endif

/* rtos_set_svc_debuginfo.c */
#ifdef CONFIG_RTOS_FS_NFS_DEBUG
void nfsd_set_rpc_srv_throttle(u64 throttle);
u64 nfsd_get_rpc_srv_throttle(void);
void svc_update_debuginfo(const struct svc_procedure *procp, u64 start);
#else
static inline void nfsd_set_rpc_srv_throttle(u64 throttle) {}
static inline void svc_update_debuginfo(const struct svc_procedure *procp, u64 start) {}
static inline u64 nfsd_get_rpc_srv_throttle(void)
{
	return 0;
}
#endif

/* rtos_set_rpc_debuginfo.c */
#ifdef CONFIG_RTOS_FS_NFS_DEBUG
void nfs_set_rpc_clnt_throttle(u64 throttle);
u64 nfs_get_rpc_clnt_throttle(void);
void rpc_update_debuginfo(struct rpc_task *task);
#else
static inline void nfs_set_rpc_clnt_throttle(u64 throttle) {}
static inline void rpc_update_debuginfo(struct rpc_task *task) {}
static inline u64 nfs_get_rpc_clnt_throttle(void)
{
	return 0;
}
#endif
#endif /* __RTOS_DEBUGINFO_H__ */